package com.cuijq.ms.singleton.log;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

/**
 * @Classname Logger
 * @Description TODO
 * @Date 2021/5/5 9:21
 * @Created by CuiJQ
 */
public class Logger {

  private FileWriter writer;
  private static final Logger instance = new Logger();



  private Logger()  {
    File file = new File("/Users/wangzheng/log.txt");
    try {
      writer = new FileWriter(file,
          true); //true表示追加写入
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

  public static Logger getInstance() {
    return instance;
  }

  public void log(String message) throws IOException {
    writer.write(message);
  }
}
